package com.artqiyi.dollmachine.utils;

import android.content.Context;
import android.content.pm.PackageInfo;

/**
 * author: PengCheng
 * time: 2018/1/13 0013
 * desc:
 */

public class AppUtils {
    /**
     * 获取本地软件版本号名称
     */
    public static String getVersionName(Context context) {
        String localVersion = "";
        try {
            PackageInfo packageInfo = context.getApplicationContext()
                    .getPackageManager()
                    .getPackageInfo(context.getPackageName(), 0);
            localVersion = packageInfo.versionName;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return localVersion;
    }
}
